home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / sysprof3.zip / PROFCTRL.C < prev    next >
C/C++ Source or Header  |  1989-06-20  |  49KB  |  1,120 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*                                 Listing 2                                 */
  4. /*                                                                           */
  5. /*  NAME : PROFCTRL                                                          */
  6. /*                                                                           */
  7. /*  DATE : March 30, 1988                                                    */
  8. /*                                                                           */
  9. /*  AUTHOR : (C) Copyright 1988 G. Kent Cobb - All Rights Reserved           */
  10. /*                                                                           */
  11. /*  DESCRIPTION :                                                            */
  12. /*      This program provides control functions for the terminate-and-stay-  */
  13. /*      resident system profiler.  The syntax for executing PROFCTRL is:     */
  14. /*                                                                           */
  15. /*                                                                           */
  16. /*                          |   STATUS                     |                 */
  17. /*                          |     ON                       |                 */
  18. /*                 PROFCTRL |     OFF                      |                 */
  19. /*                          |    ZERO                      |                 */
  20. /*                          |   REPORT [output-file-name]  |                 */
  21. /*                                                                           */
  22. /*      The ON and OFF options affect the accumulation of interrupt data;    */
  23. /*      STATUS reports the current state; ZERO erases all data that has      */
  24. /*      been accumulated; and REPORT generates a listing that describes      */
  25. /*      the contents of the tables.                                          */
  26. /*                                                                           */
  27. /*      SYS_PROF and PROFCTRL are most easily used in a batch file, such as: */
  28. /*                                                                           */
  29. /*                                                                           */
  30. /*                            SYS_PROF                                       */
  31. /*                            PROFCTRL zero                                  */
  32. /*                            PROFCTRL on                                    */
  33. /*                            chkdsk c:                                      */
  34. /*                            PROFCTRL off                                   */
  35. /*                            PROFCTRL report temp                           */
  36. /*                            d:list temp                                    */
  37. /*                                                                           */
  38. /*****************************************************************************/
  39. /*  modifications for Turbo C and updated function descriptions              */
  40. /*  by Ralf Brown, 5/18/89                                                   */
  41. /*****************************************************************************/
  42. /*  additional function call tracking added by Ralf Brown, 6/18/89           */
  43. /*****************************************************************************/
  44.  
  45. #include "stdio.h"
  46. #include "dos.h"
  47. #ifdef __TURBOC__
  48. #  include <stdlib.h>
  49. #  include <string.h>
  50. #endif __TURBOC__
  51.  
  52. #define NUM_INTS 13
  53. #define END_OF_STRING '\0'
  54.  
  55. #define CONTROL_INTERRUPT   96
  56. #define STATUS          0
  57. #define OFF             1
  58. #define ON              2
  59. #define FIND            3
  60. #define ZERO            4
  61. #define REPORT          5
  62.  
  63. #define DOS             0x21
  64. #define GET_INT_VECTOR  0x35
  65.  
  66. #ifdef __TURBOC__  /* prototype the functions */
  67. int error_exit(void) ;
  68. int tally_total_ticks(void) ;
  69. int print_interrupt_summary( int, char *descriptions[] ) ;
  70. int print_line(char *title, long number, long duration) ;
  71. #endif __TURBOC__
  72.  
  73. struct tally
  74.     {
  75.     long time;
  76.     long number;
  77.     };
  78.  
  79. long total_ticks;       /*  TOTAL NUMBER OF TIMER TICKS RECORDED.  */
  80.  
  81. char *int_desc[NUM_INTS+1] = {"OTHER",
  82.                               "PRINT SCREEN - INTERRUPT 5H",
  83.                               "VIDEO BIOS - INTERRUPT 10H",
  84.                               "DISK SERVICES - INTERRUPT 13H",
  85.                               "COMM PORT - INTERRUPT 14H",
  86.                               "SYSTEM UTILITY SERVICES - INTERRUPT 15H",
  87.                               "KEYBOARD BIOS - INTERRUPT 16H",
  88.                               "PRINTER BIOS - INTERRUPT 17H",
  89.                               "DOS FUNCTIONS - INTERRUPT 21H",
  90.                               "DOS ABSOLUTE DISK READ - INTERRUPT 25H",
  91.                               "DOS ABSOLUTE DISK WRITE - INTERRUPT 26H",
  92.                               "NETWORK - INTERRUPT 2AH",
  93.                               "MULTIPLEX - INTERRUPT 2FH",
  94.                               "EXPANDED MEMORY DRIVER - INTERRUPT 67H" };
  95.  
  96. int max_services[NUM_INTS+1] = {0,0,29,29,6,223,19,3,109,0,0,7,206,108};
  97.  
  98. char *other_services[] = {""};
  99. char *print_screen_services[] = {""};
  100. char *video_services[] = {"00 - Set Mode",
  101.                           "01 - Set Cursor Size",
  102.                           "02 - Set Cursor Position",
  103.                           "03 - Get Cursor Position",
  104.                           "04 - Get Light Pen Position",
  105.                           "05 - Set Active Page",
  106.                           "06 - Scroll Up",
  107.                           "07 - Scroll Down",
  108.                           "08 - Read Character and Attribute",
  109.                           "09 - Write Character and Attribute",
  110.                           "0A - Write Character",
  111.                           "0B - Set Palette",
  112.                           "0C - Write Dot",
  113.                           "0D - Read Dot",
  114.                           "0E - Write TTY",
  115.                           "0F - Get Mode",
  116.                           "10 - Service 16",
  117.                           "11 - Service 17",
  118.                           "12 - Alternate function select",
  119.                           "13 - Write String",
  120.                           "14 - LCD fonts",
  121.                           "15 - Get physical display parameters",
  122.                           "16 - Service 22",
  123.                           "17 - Service 23",
  124.                           "18 - Service 24",
  125.                           "19 - Service 25",
  126.                           "1A - Display combination",
  127.                           "1B - Functionality/State information",
  128.                           "1C - Save/Restore video state",
  129.                           "Undefined services"};
  130. char *disk_services[] = {"00 - Reset Diskette System",
  131.                          "01 - Get Diskette Status",
  132.                          "02 - Read Sectors",
  133.                          "03 - Write Sectors",
  134.                          "04 - Verify Sectors",
  135.                          "05 - Format Track",
  136.                          "06 - Fixed Disk - Format track",
  137.                          "07 - Fixed Disk - Format drive",
  138.                          "08 - Get Drive Parameters",
  139.                          "09 - Initialize Parameter Tables",
  140.                          "0A - Read Long",
  141.                          "0B - Write Long",
  142.                          "0C - Seek to Cylinder",
  143.                          "0D - Alternate Disk Reset",
  144.                          "0E - Read sector buffer",
  145.                          "0F - Write sector buffer",
  146.                          "10 - Test Ready",
  147.                          "11 - Recalibrate Drive",
  148.                          "12 - Controller RAM Diagnostics",
  149.                          "13 - Drive Diagnostics",
  150.                          "14 - Controller Diagnostics",
  151.                          "15 - Get Disk Type",
  152.                          "16 - Change Disk Status",
  153.                          "17 - Set Disk Type",
  154.                          "18 - Set Media Type for Form